namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using System.IO;

    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Deployment;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;

    using SharePoint.Wss.Webs;

    using Wss.ContentMigration;

    using SharePoint.Wss.ContentMigration;

    using TestHelper=Collaboris.Saf.Actions.Wss.Tests.TestHelper;

    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class ExportListTest
    {
        [TestMethod]
        public void ExportList_Test()
        {
            WSSTestAssistant<ExportList, ListExportSettings> exportlist =
                    new WSSTestAssistant<ExportList, ListExportSettings>(TestEnvironment.PublishingSite,
                        "ExportListTestWeb", "BLANKINTERNET#0");

            using (exportlist)
            {
                string filename = Path.Combine(
                    exportlist.FirstEntity.ExportSettings.FileLocation,
                    exportlist.FirstEntity.ExportSettings.BaseFileName);

                if (File.Exists(filename))
                {
                    File.Delete(filename);
                }

                // creates a test person list
                TestHelper.CreateTasksList(exportlist.TestWeb, true, true);

                MacroReport doReport = exportlist.DoMacro();
                
                Assert.IsTrue(File.Exists(filename));

                // this should now - hopefully - go an import the list into the new web...
                ImportListTest importListTest = new ImportListTest();
                importListTest.ImportList_Test();

            }
        }

        public void Mike_Test()
        {
            WSSTestAssistant<ExportList, ListExportSettings> exportlist =
                    new WSSTestAssistant<ExportList, ListExportSettings>(TestEnvironment.PublishingSite,
                        "ExportListTestWeb", "BLANKINTERNET#0");

            using (exportlist)
            {
                exportlist.FirstEntity.ListName = "Google Collections";
                exportlist.FirstEntity.IgnoreSubWebs = true;
                exportlist.FirstEntity.ExportSettings.FileCompression = true;
                exportlist.FirstEntity.ExportSettings.IncludeDependencies = false;
                exportlist.FirstEntity.ExportSettings.IncludeSecurity = false;
                exportlist.FirstEntity.ExportSettings.IncludeVersions = false;
                exportlist.FirstEntity.ExportSettings.OverwriteExistingDataFile = true;
                exportlist.TestWeb = exportlist.TestSite.RootWeb;
                MacroReport doReport = exportlist.DoMacro();

            }
        }

    }
}
